package com.yupi.springbootinit.api;


import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;

import java.util.HashMap;
import java.util.Map;

public class OpenAiApi {
    public static void main(String[] args) {
        String url="https://xxxxxxx";
        Map<String,Object> hashMap=new HashMap<>();
        hashMap.put("message","用户的消息，请帮我分析");
        String json = JSONUtil.toJsonStr(hashMap);
        String result = HttpRequest.post(url)
                .header("Authorization", "Bearer 替换成你的key")
                .body(json)
                .execute()
                .body();
        System.out.println(result);
    }
}
